The Picture object

The Picture object is used to represent a picture in an album.

Properties:

sFileNameStringread-writeFull pathname of the picture.
sShortFileNameStringread-onlyBase filename of the picture.
sCommentStringread-writeThe full comment of the picture.
sCommentFirstLineStringread-onlyThe first line of comment of the picture.
dwFileSizeLongread-writeSize of the file containing the picture.
lFileTimeLongread-writeDate and time of the picture file.
wLongread-writeWidth of the picture in pixels.
hLongread-writeHeight of the picture in pixels.
bppLongread-writeColor depth of the picture.
sURLStringread-writeURL associated to the picture.
sPlayCmdStringread-writeBackground music command for the picture.
bSelectedBooleanread-writeSelection state of the picture.
lStatusLongread-writeStatus of the picture.
nbKeywordLongread-onlyNumber of keywords attached to this picture.
nbCustomFieldLongread-onlyNumber of custom fields defined for this picture.
AlbumObjectread-onlyThe album the picture belongs to.
numLongread-onlyPosition (0 based) of the picture in the album.
nextObjectread-onlyNext picture in the album.
prevObjectread-onlyPrevious picture in the album.
nPicDataCountLongread-onlyNumber of picture data blocks.
lDisplayModeLongread-writePicture level display mode.
lTransitionLongread-writeType of transition (hi-word) and delay in 1/10s (lo-word).
rcCropObjectread-writeCropping rectangle (rect object).
nRotationLongread-writePicture rotation (reserved).

Methods:

HasKeyword(pszKW As String) As Boolean
Test if the picture has the given keyword.

SetKeyword(pszKW As String, bSet As Boolean) As Boolean
Set or clear the specified keyword for the picture.

GetCustomField(pszCF As String) As String
Get the value of the specified custom field. This method can be used whatever the type of the custom field.

GetCustomFieldDate(pszCF As String) As Long
Get the time value (time_t) of the specified custom field. This method can only be used with date or time custom fields.

SetCustomField(pszCF As String, pszValue As String)
Set the string value of the specified custom field. This method can only used with string custom fields.

SetCustomFieldDate(pszCF As String, lDateTime As Long)
Set the time value of the specified custom field. This method can only be used with date or time custom fields.

SaveThumbnail(sNewFile As String, nFileType As Long) As Boolean Save the thumbnail of the picture in a file.

ConvertAndResize(sNewFile As String, nFileType As Long, nNewWidth As Long, nNewHeight As Long) As Boolean
Convert and/or resize the picture and save it to a new file. Set nNewWidth and nNewHeight to zero to keep the same dimensions.

ConvertAndResize2(sNewFile As String, nFileType As Long, nNewWidth As Long, nNewHeight As Long, nResizeMode as Long, crBack as Long, nAngle as Long) As Boolean
Extended version of ConvertAndResize. If nResizeMode = RM_BOUNDINGRECT (0), the specified size is the maximal size of the picture (preserving the aspect ratio), if nResizeMode = RM_EXACTSIZE (1) a border filled with the crBack color is added to match the specified size, if nResizeMode = RM_STRETCH (2) the picture is freely resized to the specified size (aspect ration non preserved). Rotation (angle must be 0, 90, 180 or 270) and cropping are available.

Resize(nNewWidth As Long, nNewHeight As Long, nResizeMode as Long, crBack as Long, nAngle as Long) As Boolean
Same as ConvertAndResize2 but the modified picture is not saved to a file and reside only in memory.

SetCropRect (l As Long, t As Long, r As Long, b as Long)
Set the cropping rectangle (left, top, right, bottom) used by ConvertAndResize2 and the display cropping. Set all coordinates to zero to cancel cropping. Cropping rectangle can also be accessed with the rcCrop property.

UpdateThumbnail(bForce As Boolean) As Boolean
Update the thumbnail if the picture has changed or update it anyway if bForce is True.

Copy(nPic As Long) As Boolean
Copy the picture to the clipboard (nPic=-1, copy the thumbnail, nPic=0..n, copy the picture or one of the sub-pictures).

CopyRect(left As Long, top As Long, right As Long, bottom As Long, nPic As Long) As Boolean
Copy a rectangle from the picture to the clipboard. Coordinates are from the upper left corner of the picture. The nPic parameter is unused and must be zero.

PasteToThumbnail(bResize As Boolean) As Boolean
Replace the thumbnail with the bitmap content of the clipboard. If bResize is True, the bitmap is resized to match the album thumbnail size.

SetTextStampInfo(sText As String, sFont As String, crColor As Long, xPos As Long, yPos As Long) As Boolean Set the stamping information (text) for the ConvertAndResize method.

SetPictureStampInfo(sPicFile As String, xPos As Long, yPos As Long) As Boolean
Set the stamping information (bitmap) for the ConvertAndResize method.

Paste(xPos As Long, yPos As Long) As Boolean
Paste the bitmap from the clipboard to the picture at the specified position.

DrawText(sString As String, rect As Object, sFont As String, crColor As Long, crBkColor As Long, nFormat As Long) As Long
Draw a text on the picture. rect is the bounding text and must be a MyAlbum.rect object. Set crBkColor to -1 for a transparent background. For the nFormat use the DT_xxx constants of the DrawText Windows API.

DrawLine(x1 As Long, y1 As Long, x2 As Long, y2 As Long, nWidth as Long nStyle As Long, crColor As Long) As Long
Draw a line on the picture. nWidth specifies the style: 0 for solid, 1 for dashed.

DrawRectangle(rect As Object, nWidth As Long, crFrameColor As Long, crFillColor As Long, bStyle As Long, wE As Long, hE As Long) As Boolean
Draw a rectangle (nStyle=DRAWRECT_RECT (0)), a rounded rectangle (nStyle= DRAWRECT_ROUNDRECT (1)) or an ellipse (nStyle= DRAWRECT_ELLIPSE (2)) on the picture. rect specifies the size of the drawing and must be a MyAlbum.MyRect object. You can specify a border with a width (nWidth) and a color (crFrameColor or -1 for an unfilled drawing).

GetPixel(x As Integer, y As Integer) As Long
Gets the color of the pixel at coordinates x and y. 0,0 is the upper-left corner of the picture. The returned value is coded in RGB (one byte for each color). รป1 is returned if an error occurs (the picture must be a 8, 16, 24 or 32 bit per pixel bitmap).

SetPixel(x As Integer, y As Integer, color As Long)
Sets the color of the pixel at coordinates x and y. 0,0 is the upper-left corner of the picture. The color parameter is coded in RGB (one byte for each color). The picture must be a 16, 24 or 32 bit per pixel bitmap.

Mirror() As Boolean
Mirror the image (left <--> right).

Flip() As Boolean
Flip the image (top <--> bottom).

GetPicDataType(iPicData As Long) As Long
Get the type of a picture data block.

GetPicDataSize(iPicData As Long) As Long
Get the size of a picture data block.

SavePicData(iPicData As Long, sFile As String) As Boolean
Save a picture block in a file.

Load(bLoad As Boolean) As Boolean
Load (or unload) the picture in memory.

Save( sNewFile as String, bReplaceInAlbum As Boolean) As Boolean
Save the loaded picture to a new file (using its current state in memory). Set the bReplaceInAlbum to True to have the new filename used in the current album instead of the current picture filename.
Caution: Specifying the name of an existing file will overwrite it.

xmlEncode(nType as long, [optional] uFlags as Long) As String
Encode the picture as a XML string. nType is reserved and must be 0.
By default external files (the picture file and the files referenced by the Play Command) are included in the xml stream.
Optional parameter: uFlags = XML_Default.

SetAsWallpaper(bUseCropRect as Boolean) As Boolean
Set the picture as the desktop wallpaper. Set bUseCropRect to True to use only the part of the picture defined by its cropping rectangle.

MakeAnaglyph(picLeft As Object, picRight As Object, nAnaType As Short, dx As Short, dy As Short) As Boolean
Compute a 3D picture from two pictures. Use the T3D_... constants (see below) for the nAnaType parameter. The dx and dy parameters are used to specify the offset of the right picture.

Constants:

Picture status:

This is a 32 bit value containing various information:

Bit 0 to 7Picture type:
   TYPE_NONE0Unknown
   TYPE_BMP1BMP
   TYPE_JPEG2JPEG
   TYPE_GIF3GIF
   TYPE_PNG4PNG
   TYPE_PCX5PCX
   TYPE_TIFF6TIFF
   TYPE_TGA7TGA
   TYPE_WMF8WMF/EMF
 10 - 11reserved
   TYPE_VBS12VBS script
   TYPE_JS13JS script
   TYPE_WAVE14WAV
   TYPE_MIDI15MIDI
   TYPE_JPEGGIF16JPEG/GIF
   TYPE_JPEGPNG17JPEG/PNG
   TYPE_HTML20HTML
   TYPE_MP321MP3
   TYPE_ALB30Album
   TYPE_VID31Video
Bit 8STATE_NEWPicture is new in album.
Bit 9STATE_HIDDENPicture is hidden.
Bit 10STATE_MULTIPicture has sub-picture (animated GIF or TIFF).
Bit 11STATE_METAFILEPicture is a Metafile.
Bit 12STATE_VIDEOPicture is a video.
Bit 16STATE_MARKEDPicture is marked (internal use).
Bit 17STATE_FLAGGEDPicture is flagged (little red X).

XML Export/Import options:

This is a 32 bit value containing the following information:

XML_Default  0  Default behaviour.
XML_NoFiles  1Export: Do not include the external files in the xml stream.
XML_FullPathName  2Export: Store the full pathname of the external files in the the xml stream.

MakeAnaglyph constants:

T3D_AnaRedGreen  0  B&W anaglyph to be used with Red and Green glasses.
T3D_AnaRedBlue  1  B&W anaglyph to be used with Red and Blue glasses.
T3D_AnaRedCyan  5  B&W anaglyph to be used with Red and Cyan glasses.
T3D_AnaColor  2  Pseudo-color anaglyph to be used with Red and Cyan glasses.
T3D_InterlaceL  3  Produce an interlaced image (left picture first) to be used with LCD glasses.
T3D_InterlaceR  4  Produce an interlace image (right picture first) to be used with LCD glasses.